package com.gupaoedu.demo.mvc.action;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.gupaoedu.demo.service.IDemoService;
import com.gupaoedu.mvcframework.annotation.GPAutowried;
import com.gupaoedu.mvcframework.annotation.GPController;
import com.gupaoedu.mvcframework.annotation.GPRequestMapping;
import com.gupaoedu.mvcframework.annotation.GPRequestParam;

@GPRequestMapping("/demoAction")
@GPController
public class DemoAction {
	
	@GPAutowried private IDemoService demoService;
	
	@GPRequestMapping("/query.json")
	public void query(HttpServletRequest request,HttpServletResponse response,@GPRequestParam("name") String name){
		String result=demoService.get(name);
		try {
			response.getWriter().write(result);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@GPRequestMapping("/edit.json")
	public void edit(HttpServletRequest request,HttpServletResponse response,@GPRequestParam("id")String id){
		
	}
	
	@GPRequestMapping("/remove.json")
	public void remove(HttpServletRequest request,HttpServletResponse response,@GPRequestParam("id")String id){
		
	}
}
